package com.fxm.controller;

import com.fxm.domain.Error;
import com.fxm.returns.RespEntity;
import com.fxm.service.ErrorService;
import com.fxm.vo.param.ErrorParam;
import com.fxm.vo.param.OpenParam;
import com.fxm.vo.result.ErrorQuestionResult;
import com.fxm.vo.result.ErrorResult;
import com.fxm.vo.result.QuestionResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 答题 前端控制器
 * </p>
 *
 * @author fxm
 * @since 2021-01-07
 */
@RestController
@RequestMapping("/error")
@Slf4j
@Api(value = "错题接口", tags = "错题接口")
public class ErrorController {

    @Resource
    private ErrorService errorService;

    @PostMapping("/list")
    @ApiOperation(value = "错题集列表")
    public RespEntity<List<ErrorResult>> errorList(@RequestBody OpenParam openParam) {
        RespEntity<List<ErrorResult>> respEntity = errorService.errorList(openParam);
        return respEntity;
    }

    @PostMapping("/query")
    @ApiOperation(value = "获取错题信息")
    public RespEntity<List<ErrorQuestionResult>> queryErrorQuestion(@RequestBody ErrorParam errorParam) {
        RespEntity<List<ErrorQuestionResult>> respEntity = errorService.queryErrorQuestion(errorParam);
        return respEntity;
    }

}
